<?php

namespace Common\Model;

use Think\Model;

class BoxmanModel extends Model {
    
    public function updateOrderBoxman($boxman_phone='', $boxman_name=''){
        if(empty($boxman_phone)){
            return FALSE;
        }
        $boxmanInfo = $this->where(['boxman_phone'=>$boxman_phone])->find();
        if($boxmanInfo){
            $boxman_id = $boxmanInfo['boxman_id'];
            $this->where(['boxman_id'=>$boxman_id])->save(['boxman_name'=>$boxman_name]);
        }else{
            $data['boxman_phone'] = $boxman_phone;
            $data['boxman_name'] = $boxman_name;
            $boxman_id = $this->add($data);
        }
        return $boxman_id;
    }
}
